﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace TestStudentsAndCourses
{
    [TestClass()]
    public class StudentTest
    {
        [TestMethod()]
        public void StudentConstructorTest()
        {
            string names = "someName";
            int facultyNumber = 38433;
            Student target = new Student(names, facultyNumber);
            Assert.AreEqual(target.Names, names, "The names differ");
            Assert.AreEqual(target.FacultyNumber, facultyNumber, "The faculty numbers differ");
        }

        [TestMethod()]
        public void FacultyNumberPropertyTest()
        {
            string names = "someName";
            int facultyNumber = 10002; 
            Student target = new Student(names, facultyNumber);
            int expected = 10001; 
            int actual;
            target.FacultyNumber = expected;
            actual = target.FacultyNumber;
            Assert.AreEqual(expected, actual, "The faculty number differ");
        }

        [TestMethod()]
        public void NamesPropertyTest()
        {
            string names = "someName"; 
            int facultyNumber = 10001; 
            Student target = new Student(names, facultyNumber);
            string expected = "Pe6o";
            string actual;
            target.Names = expected;
            actual = target.Names;
            Assert.AreEqual(expected, actual, "The names differ");
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentOutOfRangeException))]
        public void InvalidFacultyNumberTest()
        {
            string names = "someName";
            int facultyNumber = 100;
            Student target = new Student(names, facultyNumber);
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void InvalidNamesTest()
        {
            string names = "";
            int facultyNumber = 10011;
            Student target = new Student(names, facultyNumber);
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void NullNamesTest()
        {
            string names = null;
            int facultyNumber = 10011;
            Student target = new Student(names, facultyNumber);
        }

        [TestMethod()]
        public void NullEqualTest()
        {
            Student st1 = new Student("someName", 11111);
            Student st2 = null;
            bool expected = false;
            bool actual = st1.Equals(st2);
            Assert.AreEqual(expected, actual);
        }
    }
}
